package org.mdrtwell.swing.labeltextscroll;

import javax.swing.JLabel;

public class TextChanger implements Runnable {
	private JLabel	label;

	public TextChanger(JLabel label) {
		this.label = label;
	}

	public void run() {
		try {
			while (true) {
				String text = label.getText();
				if (text.length() > 1) {
					text = text.charAt(text.length() - 1) + text.substring(0, text.length() - 1);
					label.setText(text);
					label.repaint();
				}
				Thread.sleep(100);
			}
		} catch (InterruptedException ex) {
			ex.printStackTrace();
		}
	}
}
